package com.xuan.service.pg.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xuan.dto.pg.liuyao.PgLiuYaoDto;
import com.xuan.mapper.pg.PgLiuYaoMapper;
import com.xuan.pojo.pg.PgLiuYao;
import com.xuan.service.pg.PgLiuYaoService;
import com.xuan.utils.xuan.liuyao.LiuYao;
import com.xuan.utils.xuan.liuyao.LiuYaoSetting;
import com.xuan.vo.pg.liuyao.PgLiuYaoVo;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

/**
 * 六爻起卦Impl
 */
@Service
public class PgLiuYaoServiceImpl extends ServiceImpl<PgLiuYaoMapper, PgLiuYao> implements PgLiuYaoService {

    /**
     * 开始起卦
     *
     * @param dto 六爻起卦数据接收类
     * @return 起卦结果
     */
    @Override
    public PgLiuYaoVo starts(PgLiuYaoDto dto) {

        // 1、拷贝六爻起卦设置
        LiuYaoSetting setting = new LiuYaoSetting();
        BeanUtils.copyProperties(dto, setting);

        // 2、六爻起卦
        LiuYao LiuYao = new LiuYao(setting);

        // 3、返回数据
        PgLiuYaoVo vo = new PgLiuYaoVo();
        BeanUtils.copyProperties(LiuYao, vo);
        return vo;

    }


}
